/* Flash OS Routines (Automagically Generated)
 * Copyright (c) 2009-2015 ARM Limited
 */
#include "flash_blob.h"

static const uint32_t flash_code[] = {
    0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
    0x8F4FF3BF, 0x46014770, 0x0E000300, 0xD3022820, 0x1D000940, 0x2810E005, 0x0900D302, 0xE0001CC0,
    0x02C90880, 0x2110D501, 0x47704308, 0x4949484A, 0x494A6041, 0x21006041, 0x68C16001, 0x431122F0,
    0x694060C1, 0xD4060680, 0x49454846, 0x21066001, 0x49456041, 0x20006081, 0x483F4770, 0x05426901,
    0x61014311, 0x47702000, 0x483BB510, 0x24046901, 0x61014321, 0x03626901, 0x61014311, 0x00526901,
    0x61014311, 0x4A374939, 0x6011E000, 0x03DB68C3, 0x6901D4FB, 0x610143A1, 0xBD102000, 0x213FB530,
    0x18400549, 0xFFAFF7FF, 0x68CA492B, 0x431A23F0, 0x240260CA, 0x690A610C, 0x0E0006C0, 0x610A4302,
    0x03E26908, 0x61084310, 0x4A264828, 0x6010E000, 0x03ED68CD, 0x6908D4FB, 0x610843A0, 0x060068C8,
    0xD0030F00, 0x431868C8, 0x200160C8, 0xB5F0BD30, 0x1CC94D19, 0x68EB0889, 0x27F00089, 0x60EB433B,
    0x612B2300, 0xE0204C19, 0x4E19692B, 0x612B4333, 0x055B233F, 0x681618C3, 0xF3BF601E, 0x4B118F4F,
    0x601CE000, 0x03F668EE, 0x692BD4FB, 0x005B085B, 0x68EB612B, 0x0F1B061B, 0x68E8D004, 0x60E84338,
    0xBDF02001, 0x1F091D00, 0x29001D12, 0x2000D1DC, 0x0000BDF0, 0x45670123, 0x40023C00, 0xCDEF89AB,
    0x00005555, 0x40003000, 0x00000FFF, 0x0000AAAA, 0x00000201, 0x00000000
};

const program_target_t flash_algo = {
    0x2000004D,  // Init
    0x2000007B,  // UnInit
    0x20000089,  // EraseChip
    0x200000BD,  // EraseSector
    0x2000010F,  // ProgramPage

    // BKPT : start of blob + 1
    // RSB  : address to access global/static data
    // RSP  : stack pointer
    {
        0x20000001,
        0x20000C00,
        0x20001000
    },

    0x20000400,  // mem buffer location
    0x20000000,  // location to write prog_blob in target RAM
    sizeof(flash_code),  // prog_blob size
    flash_code,  // address of prog_blob
    0x00000200,  // ram_to_flash_bytes_to_be_written
};